package controller

import (
	bc "Agricultural/application/blockchain"
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

// 登录
func Login(ctx *gin.Context)  {
	account := ctx.Query("account")
	password := ctx.Query("password")
	companyType := ctx.Query("companyType")
	resp, err := bc.ChannelExecute("login", [][]byte{
		[]byte(account),
		[]byte(password),
		[]byte(companyType),
	})
	if err != nil {
		fmt.Println("ERROR: ", err.Error())
		ctx.String(http.StatusInternalServerError, err.Error())
		return
	}
	ctx.JSON(http.StatusOK, resp)
}